/* =========================================================================
 *
 *   The traffic processor.
 *
 *   Development by Sedelnikov Alexander (Bigking).
 *
 * =========================================================================
 */

#ifndef __JOB_MANAGER_H__
#define __JOB_MANAGER_H__


#include "processor.h"
#include "out.h"


//------------------------------------------------------------------------//
class cjob_manager
{


    static cjob_manager           singleton;


    std::vector<source_file>      files;

    uint                          th_cnt, time_interval;

    cparser                     **parsers;
    cfile_base                  **inputs;
    chash_table<trf_gth>        **hashes;

    ulong                         procs_indexes[ MAX_THREADS ],
                                  procs_lengths[ MAX_THREADS ];


protected:

    cjob_manager();
    ~cjob_manager();

    cparser*    get_parser();
    cfile_base* get_input ();

    void   scan_source_folder();
    void   interval_distribute();
    void   prepare_processors();
    void   process_source();
    void   save_result();


public:

    static int do_job( );


//------------------------------------------------------------------------//
EXCEPTION( e_error );


};


#endif
